package com.weimei.conversionTreasure.viewModel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableArrayList;
import androidx.databinding.ObservableField;
import androidx.databinding.ObservableList;

import com.chad.library.BR;
import com.weimei.conversionTreasure.R;
import com.weimei.conversionTreasure.http.entity.MonthDetailBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.ItemViewModel;
import me.tatarka.bindingcollectionadapter2.ItemBinding;

public class MonthDetailItemVM extends ItemViewModel {

    public ObservableField<MonthDetailBean.DataDTO.DInfoDTO> entity = new ObservableField<>();

    public ObservableList<MonthDetailItemCVM> observableList = new ObservableArrayList<>();
    public ItemBinding<MonthDetailItemCVM> itemBinding = ItemBinding.of(BR.viewModel, R.layout.item_m_d_c);


    public MonthDetailItemVM(@NonNull BaseViewModel viewModel, MonthDetailBean.DataDTO.DInfoDTO data) {
        super(viewModel);
        entity.set(data);
        for (MonthDetailBean.DataDTO.DInfoDTO.DlistDTO bean:data.getDlist()) {
            MonthDetailItemCVM itemCVM = new MonthDetailItemCVM(viewModel,bean);
            observableList.add(itemCVM);
        }

    }
}
